"""
开放商户 - 支付宝实名查询相关模型
"""

from jlpay.model.base import OrgBaseReq, BaseResponse


class RealnameAliQueryRequest(OrgBaseReq):
    """支付宝实名查询请求"""
    
    API_URL = "/open/merch/access/alipay/realname/query"
    
    def __init__(self):
        """初始化支付宝实名查询请求"""
        super().__init__()
        self.merch_no = None
        self.query_type = "0"  # 查询类型，0-申请单查询（默认），1-授权结果查询
    
    def set_merch_no(self, merch_no):
        """
        设置商户号
        
        Args:
            merch_no: 商户号
            
        Returns:
            RealnameAliQueryRequest实例
        """
        self.merch_no = merch_no
        return self
    
    def set_query_type(self, query_type):
        """
        设置查询类型，0-申请单查询（默认），1-授权结果查询
        
        Args:
            query_type: 查询类型
            
        Returns:
            RealnameAliQueryRequest实例
        """
        self.query_type = query_type
        return self


class RealnameAliQueryResponse(BaseResponse):
    """支付宝实名查询响应"""
    
    def __init__(self, response_dict=None):
        """初始化支付宝实名查询响应"""
        super().__init__(response_dict)
        self.applyment_status = None
        self.qrcode_data = None
        self.reject_param = None
        self.reject_reason = None
        self.authorize_state = None
        
        if response_dict:
            self.applyment_status = response_dict.get('applyment_status')
            self.qrcode_data = response_dict.get('qrcode_data')
            self.reject_param = response_dict.get('reject_param')
            self.reject_reason = response_dict.get('reject_reason')
            self.authorize_state = response_dict.get('authorize_state') 